import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "Host",
    redirect: "/info",
  },
  {
    path: "/",
    name: "Home",
    component: Home,
    children: [
      {
        path: "info/",
        name: "info",
        component: () => import("../views/home/HomeView.vue")
      },
      {
        path: "search/",
        name: "orgSearch",
        component: () => import("../views/home/OrgSearchView.vue")//,
        //props: (route) => ({info: route.params.info})
      }
    ]
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited. 懒加载模式
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/home/login/Login.vue")//,
    //props: (route) => ({info: route.params.info})
  },
  {
    path: "/question",
    name: "Question",
    component: () => import("../components/Questionnaire.vue")//,
    //props: (route) => ({info: route.params.info})
  },
  {
    path: "/aboutme",
    name: "AboutMe",
    component: () => import("../views/me/AboutMe.vue")//,
    //props: (route) => ({info: route.params.info})
  },
  {
    path: "/work",
    name: "Work",
    component: () => import("../views/work/Work.vue")//,
    //props: (route) => ({info: route.params.info})
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
